;*****************************************************************************************************
;+
; NAME:
;
;      IGL_RefreshDraw
;
; PURPOSE:
;
;      This routine refreshes the graphic's hierarchy by
;      getting the top IGL_Window object of the hierarchy starting at
;      the object passed as argument and calling the DrawWindow
;      method. It is used internally by the IGL objects.
;
; CALLING SEQUENCE:
;
;      IGL_RefreshDraw, object
;
; ARGUMENTS:
;
;      OBJECT:     The object reference from where to start looking up
;                  the hierarchy for the top IGL_Window object.
;                 
; KEYWORD PARAMETERS:
;
;      _EXTRA:     Any keyword accepted by the IGL_Window::DrawWindow method.
;
; PACKAGE:
;
;    Interactive Graphics Library (IGL)
;
; AUTHORS:
;
;        RAPHAEL SADOUN
;        Graduate Student
;        Institut d'Astrophysique de Paris
;        98 bis boulevard Arago
;        75014 PARIS FRANCE
;        E-mail: raphael.sadoun@gmail.com
;
;
; MODIFICATION HISTORY:
;
;     Written by: Raphael Sadoun, 24 April 2012
;-
;*****************************************************************************************************
PRO IGL_RefreshDraw, object, _EXTRA=extr

  COMPILE_OPT idl2, HIDDEN
  ON_ERROR, 2

  ;; Make sure the input object is a valid CatAtom
  IF OBJ_ISA_VALID(object,'CatAtom') EQ 0 THEN RETURN

  ;; Get the IGL_Window at the top of the hierarchy
  window = CatGetTopObject(object)

  ;; Make sure it is a valid IGL_Window
  IF OBJ_ISA_VALID(window,'IGL_Window') EQ 0 THEN RETURN

  ;; Call the DrawWindow method
  window -> DrawWindow, _EXTRA=extra

END
